//Upload European Election Study 2009; Voter Study
use "C:\Users\User\Downloads\ZA5055_v1-1-1_stata14.dta", clear
//Egmond, Marcel van; Brug, Wouter van der; Hobolt, Sara; Franklin, Mark; Sapir, Eliyahu V. (2013): European Parliament Election Study 2009, Voter Study. GESIS Data Archive, Cologne. ZA5055 Data file Version 1.1.0, doi:10.4232/1.11760
//Keep if country == Italy
keep if t102 == 1380
//Control Variables
//Gender == Woman 
gen woman =  q102 - 1 
//education
recode q100 ( 98 88 77 = .) 
recode q100(5 6 8 9 10 11 12 13 14 15 = 1)(16 17 18 19 = 2)(20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 38 40 42 45 48 50 55 60 62 = 3)
clonevar edu = q100
//age
recode q103 (1991 1990 1989 1988 1987 1986 1985 = 1) (1984 1983 1982 1981 1980 1979 1978 1977 1976 1975 1974 1973 1972 1971 1970 = 2)  (1969 1968 1967 1966 1965 1964 1963 1962 1961 1960 1959 1958 1957 1956 1955 = 3) (1954 1953 1952 1951 1950 1949 1948 1947 1946 1945 1944 1943 1942 1941 1940 1939 1938 1937 1936 1935 1934 1933 1932 1931 1930 1929 1928 1927 1926 1925 1924 1923 1922 1920 1919 = 4)
recode q103 (7777 = .)
clonevar age = q103 
//religion
gen rel = q118 if q118 > 0
//Tradeunion Membership
recode q99 (1 2 3 = 1) (4 = 0) (7 8 = .)
clonevar  tradeunion = q99
//Unemployment
recode q110 (7=1) (1 2 3 4 5 6 8 = 0) (77 88 = .)
clonevar unemployment = q110
// party closeness
gen close_PDL  = (q87== 1380630)
gen close_LN = (q87== 1380720)
gen close_PD = (q87 == 1380331)
gen close_IDV = (q87 == 1380902)
gen close_UDC = (q87 == 1380523)
gen close_PRC = (q87 == 1380221)
gen close_SEL = (q87 == 1380212)
//Independent Variables	
// left-right proximity
recode q46 (88 77 = .), generate(lr01)
replace lr01 =  lr01 / 10
rename lr01 lr01_self
//Pro-/-Anti-European Proximity 
recode q80 (88 77 = .), generate(eu01)
replace eu01 = eu01 / 10
rename eu01 eu01_self
//ssc install estout
ssc install estout
//Regression Models
//PD
//PD Left-Right Proximity
gen lr01_PD  = 3.2 / 10
gen lrdist01_PD  = abs(lr01_self - lr01_PD)
//PD Pro-/-Anti-European Proximity
gen eu01_PD  = (6.6- 1) / 6
gen eudist01_PD  = abs(eu01_self - eu01_PD)
// PD Propensity to Vote (ptv)
gen ptv_PD = q39_p3
recode ptv_PD (77 88 89 = .)
//regress PD 
eststo clear
eststo: regress ptv_PD woman age edu rel tradeunion unemployment close_PD lrdist01_PD  eudist01_PD 
esttab , wide r2 se mtitle
//PDL
//PDL Left-Right Proximity
gen lr01_PDL  = 7.6 / 10
gen lrdist01_PDL  = abs(lr01_self - lr01_PDL)
//PDL Pro-/-Anti-European Proximity
gen eu01_PDL  = (4.7- 1) / 6
gen eudist01_PDL  = abs(eu01_self - eu01_PDL)
// PDL Propensity to Vote (ptv)
gen ptv_PDL = q39_p1
recode ptv_PDL (77 88 89 = .) 
//regress PDL
eststo clear
eststo: regress ptv_PDL woman age edu rel tradeunion unemployment close_PDL lrdist01_PDL  eudist01_PDL 
esttab , wide r2 se mtitle
//LN
//LN Left-Right Proximity
gen lr01_LN  = 8.6 / 10
gen lrdist01_LN  = abs(lr01_self - lr01_LN)
//LN Pro-/-Anti-European Proximity
gen eu01_LN  = (2.7- 1) / 6
gen eudist01_LN  = abs(eu01_self - eu01_LN)
//LN Propensity to Vote (ptv)
gen ptv_LN = q39_p2
recode ptv_LN (77 88 89 = .) 
//regress LN 
eststo clear
eststo: regress ptv_LN  woman age edu rel tradeunion  unemployment close_LN lrdist01_LN  eudist01_LN 
esttab , wide r2 se mtitle
//IDV
//IDV Left-Right Proximity
gen lr01_IDV  = 4.0 / 10
gen lrdist01_IDV  = abs(lr01_self - lr01_IDV)
//IDV Pro-/-Anti-European Proximity
gen eu01_IDV  = (6.1- 1) / 6
gen eudist01_IDV  = abs(eu01_self - eu01_IDV)
//IDV Propensity to Vote (ptv)
gen ptv_IDV = q39_p4
recode ptv_IDV (77 88 89 = .) 
//regress IDV 
eststo clear
eststo: regress ptv_IDV  woman age edu rel tradeunion unemployment close_IDV lrdist01_IDV  eudist01_IDV 
esttab , wide r2 se mtitle
//UDC
//UDC Left-Right Proximity
gen lr01_UDC  = 5.3 / 10
gen lrdist01_UDC  = abs(lr01_self - lr01_UDC)
//UDC Pro-/-Anti-European Proximity
gen eu01_UDC  = (6.- 1) / 6
gen eudist01_UDC  = abs(eu01_self - eu01_UDC)
// UDC Propensity to Vote (ptv)
gen ptv_UDC = q39_p5
recode ptv_UDC (77 88 89 = .) 
//Regress UDC
eststo clear
eststo: regress ptv_UDC woman age edu rel tradeunion unemployment close_UDC lrdist01_UDC  eudist01_UDC   
esttab , wide r2 se mtitle
//SEL
//SEL Left-Right Proximity
gen lr01_SEL  = 1.6 / 10
gen lrdist01_SEL  = abs(lr01_self - lr01_SEL)
//SEL Pro-/-Anti-European Proximity
gen eu01_SEL  = (4.5 - 1) / 6
gen eudist01_SEL  = abs(eu01_self - eu01_SEL)
//SEL Propensity to Vote (ptv)
gen ptv_SEL  = q39_p7
recode ptv_SEL  (77 88 89 = .) 
//Regress SEL
eststo clear
eststo: regress ptv_SEL  woman age edu rel tradeunion unemployment close_SEL lrdist01_SEL  eudist01_SEL
esttab , wide r2 se mtitle
//RC
//RC Left-Right Proximity
gen lr01_RC  = 0.6 / 10
gen lrdist01_RC   = abs(lr01_self - lr01_RC)
//RC Pro-/-Anti-European Proximity
gen eu01_RC   = (3.3 - 1) / 6
gen eudist01_RC   = abs(eu01_self - eu01_RC )
//RC Propensity to Vote (ptv)  
gen ptv_RC   = q39_p6
recode ptv_RC   (77 88 89 = .) 
//Regreess RC 
eststo clear
eststo: regress ptv_RC woman age edu rel tradeunion unemployment close_PRC lrdist01_RC eudist01_RC 
esttab , wide r2 se mtitle

// Table 2 Electoral Preferences in Italy (2009)
eststo clear
eststo: regress ptv_PD woman age edu rel tradeunion unemployment close_PD lrdist01_PD  eudist01_PD 
eststo: regress ptv_PDL woman age edu rel tradeunion unemployment close_PDL lrdist01_PDL  eudist01_PDL 
eststo: regress ptv_LN  woman age edu rel tradeunion  unemployment close_LN lrdist01_LN  eudist01_LN 
eststo: regress ptv_IDV  woman age edu rel tradeunion unemployment close_IDV lrdist01_IDV  eudist01_IDV 
eststo: regress ptv_UDC woman age edu rel tradeunion unemployment close_UDC lrdist01_UDC  eudist01_UDC   
eststo: regress ptv_RC woman age edu rel tradeunion unemployment close_PRC lrdist01_RC eudist01_RC 
eststo: regress ptv_SEL  woman age edu rel tradeunion unemployment close_SEL lrdist01_SEL  eudist01_SEL
esttab, wide r2 se mtitle

